Fills in the hNameMappings member. The handle must be freed by using the SHFreeNameMappings function.
The structure description includes the following additional information on this parameter:
hNameMappings
Handle of a filename mapping object that contains an array of SHNAMEMAPPING structures. Each structure contains the old and new path names for each file that was moved, copied, or renamed. This member is used only if fFlags includes FOF_WANTMAPPINGHANDLE.
A SHNAMEMAPPING structure is defined as follows in C:
typedef struct _SHNAMEMAPPING { // shnm
LPSTR pszOldPath; // address of old path name
LPSTR pszNewPath; // pointer to new path name
int cchOldPath; // number of characters in old path name
int cchNewPath; // number of characters in new path name
} SHNAMEMAPPING, FAR *LPSHNAMEMAPPING;
And as follows in the Win32api.txt provided by Microsoft:
Private Type SHNAMEMAPPING
pszOldPath As String
pszNewPath As String
cchOldPath As Long
cchNewPath As Long
End Type
The SHFreeNameMapping function is simple. It takes the value of the hNameMappings field from the SHFILEOPSTRUCT as a parameter and frees any data allocated for the handle.
Private Declare Sub SHFreeNameMappings Lib "shell32.dll" _
(ByVal hNameMappings As Long)
As a start, you would expect to modify the DoACopy function from the previous puzzle as shown here:
' Perform a copy operation
Private Sub DoACopy()
Dim sh As SHFILEOPSTRUCT